﻿using System;
using BasicFramework.Entities;

namespace BasicFramework.Components
{
    public interface IComponent : IDisposable
    {
        /// <summary>
        /// Gets or Sets if the Component should be enabled
        /// </summary>
        bool Enabled { get; set; }
        /// <summary>
        /// Indicates if the Component is visible and will be drawn.
        /// </summary>;
        bool Visible { get; set; }
        /// <summary>
        /// Gets the owner of this component.
        /// </summary>
        IEntity Owner { get; set; }
        /// <summary>
        /// Gets the Update Order of the Component within the Entity.
        /// </summary>
        int UpdateOrder { get; set; }
        /// <summary>
        /// Gets the Draw Order of the Component within the Entity.
        /// </summary>
        int DrawOrder { get; set; }
        /// <summary>
        /// Initialize is called when the component has been attached to an entity.
        /// </summary>
        void Initialize(bool createDependencies);
        /// <summary>
        /// Start is called after the scene is started
        /// </summary>
        void Start();
        /// <summary>
        /// Update Method, is called for every Frame
        /// </summary>
        void Update(float frame);
        /// <summary>
        /// Draw Method, is called for every Frame
        /// </summary>
        void Draw(float frame);
        /// <summary>
        /// Is called after adding the Component, to load all GraphicsContent here if needed.
        /// </summary>
        /// <param name="loadAllContent"></param>
        void LoadResources(bool loadAllContent);
        /// <summary>
        /// Is called after removing the Component from an Entity
        /// </summary>
        /// <param name="loadAllContent"></param>
        void UnloadResources(bool loadAllContent);

        event EventHandler<EventArgs> EnabledStateChanged;
        event EventHandler<EventArgs> VisibleStateChanged;
        event EventHandler<EventArgs> OwnerChanged;
        event EventHandler<EventArgs> UpdateOrderChanged;
        event EventHandler<EventArgs> DrawOrderChanged;

    }
}
